import pytest
import requests
#导入方法
from config import readconfig
#实例化调用
readcon=readconfig.Read()

#类似pytest公共方法-crm实现登录
@pytest.fixture(scope="session")
def testcrm():
    #参数
    date = {
        "username": 17868807194,
        "password": 123123
    }
    #从配置文件里面获取请求的url
    url = readcon.get_crm("cmurl")
    tim=readcon.get_crm("ctimeout")
    #url=http://182.92.197.48:8082/login
    cc=requests.post(url+"/login",data=date,timeout=int(tim))
    #http://182.92.197.48:8082/login
    getjson = cc.json()
    # 获取token
    adtoken = getjson['Admin-Token']
    #print(adtoken)
    return adtoken

# testcrm()


